From: Jan Beulich Date: Thu, 4 Aug 2016 08:03:28 +0000 (+0200) Subject: x86/time: support 32-bit wide ACPI PM timer X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~622 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=2e4c6154d4809c5066a63e30c64c3018665bb975;p=xen.git x86/time: support 32-bit wide ACPI PM timer I have no idea why we didn't do so from the beginning. Signed-off-by: Jan Beulich Tested-by: Dario Faggioli Tested-by: Joao Martins Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c index 385c0bea39..a2db18cf1b 100644 --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -481,22 +481,23 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table) if (fadt->header.revision >= FADT2_REVISION_ID) { /* FADT rev. 2 */ if (fadt->xpm_timer_block.space_id == - ACPI_ADR_SPACE_SYSTEM_IO) + ACPI_ADR_SPACE_SYSTEM_IO) { pmtmr_ioport = fadt->xpm_timer_block.address; - /* - * "X" fields are optional extensions to the original V1.0 - * fields, so we must selectively expand V1.0 fields if the - * corresponding X field is zero. - */ - if (!pmtmr_ioport) - pmtmr_ioport = fadt->pm_timer_block; - } else { - /* FADT rev. 1 */ + pmtmr_width = fadt->xpm_timer_block.bit_width; + } + } + /* + * "X" fields are optional extensions to the original V1.0 + * fields, so we must selectively expand V1.0 fields if the + * corresponding X field is zero. + */ + if (!pmtmr_ioport) { pmtmr_ioport = fadt->pm_timer_block; + pmtmr_width = fadt->pm_timer_length == 4 ? 24 : 0; } if (pmtmr_ioport) - printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", - pmtmr_ioport); + printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x (%u bits)\n", + pmtmr_ioport, pmtmr_width); #endif acpi_smi_cmd = fadt->smi_command; diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index de87e654ac..33b51d894e 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -403,6 +403,7 @@ static struct platform_timesource __initdata plt_hpet = */ u32 __read_mostly pmtmr_ioport; +unsigned int __initdata pmtmr_width; /* ACPI PM timer ticks at 3.579545 MHz. */ #define ACPI_PM_FREQUENCY 3579545 @@ -417,9 +418,15 @@ static s64 __init init_pmtimer(struct platform_timesource *pts) u64 start; u32 count, target, mask = 0xffffff; - if ( pmtmr_ioport == 0 ) + if ( !pmtmr_ioport || !pmtmr_width ) return 0; + if ( pmtmr_width == 32 ) + { + pts->counter_bits = 32; + mask = 0xffffffff; + } + count = inl(pmtmr_ioport) & mask; start = rdtsc_ordered(); target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY); diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h index 49f7e1efd4..d36bee9547 100644 --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -146,6 +146,7 @@ extern u32 x86_acpiid_to_apicid[]; #define INVALID_ACPIID (-1U) extern u32 pmtmr_ioport; +extern unsigned int pmtmr_width; int acpi_dmar_init(void); void acpi_mmcfg_init(void);